'''
''' This is the Event handler for Save Button. Add your code to customize save button behavior.
'''
Public Overrides Sub ${Button Control}_Click(ByVal sender As Object, ByVal args As EventArgs)
' Please remove the above code: SaveButton_Click_Base(sender, args) for this customization to run successfully..
' Define the URL of a page to which you want to redirect after saving the record.
Dim url As String = "../OtherPages/SomeOtherPage.aspx?Param1=1"
Dim shouldRedirect As Boolean = true
Try
' Start Transaction and save record
DbUtils.StartTransaction()
Me.SaveData()
' Modify the URL to redirect to Show page
url = Me.ModifyRedirectUrl(url, "")
Me.CommitTransaction(sender)
Catch ex As Exception
shouldRedirect = false
'If there is an Exception then display an alert message
BaseClasses.Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message)
Me.RollBackTransaction(sender)
Finally
' End Transaction
DbUtils.EndTransaction()
End Try
If shouldRedirect Then
Me.ShouldSaveControlsToSession = true
Me.Page.Response.Redirect(url)
End If
End Sub
|